package com.yantong.constant;

import java.util.*;

/**
 *余额历史记录类型
 * @author kanghaixin
 * @date 2018/9/19.11:06
 */
public enum BalanceLogStyle {
    RECHARGE(0, "充值"),
    DEDUCT(1, "扣款"),
    CASH(2, "提现"),
    ORDER_DEDUCT(3, "下单抵扣"),
    ORDER_REFUND(4, "订单退款"),
    ORDER_COMMISSION(5, "消费佣金"),
    TEAM_COMMISSION(6, "团队佣金"),
    CASH_REFUND(7, "提现退款"),
    BUY_VIP(8, "供应商货款结算"),
    REWARD_VIP(9, "购买VIP推荐奖励"),
    ORDER_PRODUCT_REFUND(10, "单品退款"),
    BUY_VIP2(11, "用户购买VIP"),
    BUY_SHiIPCARD(12, "用户购买充值卡"),
    SHiIPCARD_RETURN(13, "充值卡返现"),
    SHiIPCARD_ARRIVAL(14, "购买充值卡到账"),
    BRANCH_OFFICE_ORDER_PROFIT(15, "订单结算所属分公司分润"),
    AGENT_ORDER_PROFIT(16, "订单结算所属代理分润"),
    BanBPay(17, "电子钱包"),
    LIFE_VIP(18, "购买本地生活bVIP推荐奖励"),
    MARKETING_GROUP(19, "抢购拼团失败奖励"),
    REGISTERED(20, "新用户注册赠送"),
    autoRelease(21, "用户额度自动释放"),
    PAY_PACKAGE_SETTLEMENT(22, "大礼包结算余额"),
    JUHE_SETTLEMENT(23, "聚合支付结算余额"),
    TEAM_SETTLEMENT(24, "门店售卖结算"),
    SYS_COUNT(25, "系统定期结算佣金");

    private int code;

    private String name;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    private static Map<Integer, String> all= new HashMap<>();
    static{
        for(BalanceLogStyle balanceLogStyle: EnumSet.allOf(BalanceLogStyle.class)){
            all.put(balanceLogStyle.code, balanceLogStyle.name);
        }
    }

    public static String get(int code) {
        return all.get(code);
    }

    public static List<Map<String,Object>> getBalanceLogStyles() {
        List<Map<String,Object>> list = new ArrayList<>();
        for (BalanceLogStyle style: BalanceLogStyle.values()) {
            Map<String,Object> map = new HashMap<>();
            map.put("code", style.getCode());
            map.put("name", style.getName());
            list.add(map);
        }
        return list;
    }
    BalanceLogStyle(int code, String name) {
        this.code = code;
        this.name = name;
    }
}
